<?php
require('lib/verify.php');
require('lib/has_char.php');
require('lib/is_approved.php');

$instance_id = $_GET["id"];

$sql = "select instance_name from wm_instances where instance_id='".$instance_id."'";
$q = $db->query($sql);
$instance = $db->fetch_assoc($q);

$_category = "wardkp";
$_title = $instance["instance_name"];
require('lib/head.php');


if($_GET["error"]!="") {
  boxRed("Error");
  echo $_GET["error"];
  boxBot();
}

$sql = "select * from wm_bosses where boss_instance = $instance_id";
$result_b = $db->query($sql);

while($boss = $db->fetch_assoc($result_b)) {
  echo '<a name="boss='.$boss["boss_id"].'"></a>';
  boxTop("wardkp: <a href=\"loot-instance.php?id=" . $instance["instance_id"] . "\">" . $instance["instance_name"] ."</a> / " . $boss["boss_name"]);
  echo "Browse loot to mark items as max or min.<br /><br />
        <i>Mark items as max or mod; or unmark an item by selecting non.</i><br />";

  $boss_id = $boss["boss_id"];
  //@@todo: wishlist correspondance so we should folks what they have
  $sql = "select wm_items.item_id from wm_items 
          left join item_cache on wm_items.item_id = item_cache.item_id 
          where item_boss = '$boss_id' order by item_name asc";
  #$sql = "select * from wm_items where item_boss = '$boss_id' order by item_name asc";

  $result = $db->query($sql);
  while($item = $db->fetch_assoc($result)) {
    show_item($item, $character, $db, "$war_http/loot-instance-all.php?id=" . $instance_id . "#boss" . $boss["boss_id"], $system, 0);
    echo "<br/>";
  }
  boxBot();
 }

require('lib/foot.php');
?>

